package com.example.checkqufuface.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.checkqufuface.R;

import java.util.ArrayList;
import java.util.List;

public class SpinnerSexAdapter extends BaseAdapter {

    private List<String> data;
    private Context context;

    public SpinnerSexAdapter(Context context) {

        //性别选择
        if (data == null) {
            data = new ArrayList<>();
        }
        data.add("男");
        data.add("女");
        this.context = context;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater _LayoutInflater = LayoutInflater.from(context);
        convertView = _LayoutInflater.inflate(R.layout.spinner_item, null);
        if (convertView != null) {
            TextView _TextView1 = (TextView) convertView.findViewById(R.id.textView32);
            _TextView1.setText(data.get(position));
        }
        return convertView;
    }
}
